package bingo.security.datasecurity.impl;

import bingo.enviroment.core.EnviromentHolder;
import bingo.security.datasecurity.core.ISecurityRuleLocator;


/**
 * 2008-4-22 下午07:34:09
 * Author:yangdongyu(yangdy@bingosoft.net)
 * ReadMe:
 * ChangeLog:
 */
public abstract class DefaultRuleLocator implements ISecurityRuleLocator {


	public String locate(String action) {
		String userRole = EnviromentHolder.getEnviroment().getVariableString("currentUser.role");
		return getRule(action, userRole);
	}
	/**
	 * 根据数据操作的动作和当前用户的角色获取用户对应的规则
	 * @param action
	 * @param userRole
	 * @return
	 */
	protected abstract String getRule(String action,String userRole);

}
